#ifndef INCLUDE_LOCALIO_H
#define INCLUDE_LOCALIO_H

#ifdef __cplusplus
extern "C" {
#endif

	typedef struct LCL_FILE_S
	{
		_UINT8 lcl_flags;
		_UINT8 *lbuf_start;
		_UINT8 *lbuf_next;
		_UINT8 *lbuf_end;		/* Address AFTER last byte */
	} LCL_FILE;

#define LCL_MALLOC  0x01		/* LCL_FILE was malloc-ed at open */
#define LCL_EOF     0x80		/* EOF encountered */

#define Lcl_Start(L) (L)->lbuf_start
#define Lcl_Eof(L) (((L)->lcl_flags&LCL_EOF)?-1:0)
#define Lcl_Tell(L) (_UINT16)((L)->lbuf_next - (L)->lbuf_start)
#define Lcl_Next(L) (L)->lbuf_next
#define Lcl_Size(L) (_UINT16)((L)->lbuf_end - (L)->lbuf_next)
#define Lcl_Getc(L)   ( (((L)->lcl_flags & LCL_EOF) ? -1 : (((L)->lbuf_next < (L)->lbuf_end) ? (_INT32)(*((L)->lbuf_next++)) : (((L)->lcl_flags |= LCL_EOF), -1))))

	extern LCL_FILE *Lcl_Open(LCL_FILE *, _UINT8 *, _UINT16);
#if 0
	extern _INT16 Lcl_Peekc(LCL_FILE *);
#else
#define Lcl_Peekc(L) ( (((L)->lcl_flags & LCL_EOF) ? -1 : (((L)->lbuf_next < (L)->lbuf_end) ? (_INT32)(*((L)->lbuf_next)) : (((L)->lcl_flags |= LCL_EOF), -1))))
#endif
	extern _UINT16 Lcl_Read(LCL_FILE *, _UINT8 *, _UINT16);
	extern _INT16 Lcl_Seek(LCL_FILE *, _UINT16, _INT16);


#ifdef __cplusplus
}
#endif
#endif
